﻿using System;
using YunZuan.Models.Attributes;
using YunZuan.Models.Entities;

namespace Wholesaler.Models.DBModels
{
    [Table(TableName = "yz_order", PrimaryKey = "OrderID")]
    public class OrderInfo : BaseEntity
    {
        #region Private Properties
        private long? _orderID;
        private int? _orderStatus;
        private int? _status;//货品状态 8-19
        private long? _inventoryID;
        //private int _replacement;
        private int? _online;//回库状态 1已回库 空 待回库
        private decimal? _priceUSD;
        private decimal? _purchaseRMB;//01-10 采购RMB
        private decimal? _receiptPrice;
        private int?  _paymentStatus;
        private int?  _receiptStatus;
        private long? _customerID;
        private string _supplierCode;//string
        private int _salesUserID;
        private int _purchaseUserID;
        private DateTime? _createTime;
        private string _Remarks;
        private int? _orderType;
        private decimal? _salesExchangerate;
        private decimal? _purchaseExchangerate;
        private DateTime? _deliveryTime; //发货时间
        private string _arrivalTime;    //入库时间
        private DateTime? _payTime;    //支付时间 8-24
        private DateTime? _recTime;    //支付时间 8-24

        private int? _arrival;
        private short? _curType;//到货结算币种 1rmb 2usd 2017-02-20

        private decimal? _confirmdiscount;
        private decimal? _discountReturn;//?表示可空
        private string _sN;//货号
        private decimal? _weight;
        private string _certno; 
        private decimal? _confirmprice;
        private decimal? _confirmusd;//卖出usd 01-11
        private string _purchaseremarks;
        private string _goodsremark;//取货员备注
        private string _salesremark;//销售员备注
        private string _shipremark;//出货备注

        //
        private string _originSN;

        private string _shipNo;//出货单号8-21
        //private string _billNo;//记账单号8-23
        
        private DateTime? _shipTime;//出货时间8-21

        private int _shape;
        private string _color;
        private string _clarity;
        private string _cut;
        private string _polish;
        private string _symmetry;
        private string _fluorescence;
        private string _certType;
        private decimal? _rapnet; //rapnet统一改成decimal 为了配合数据中心的decimal
        private string _hA;
        private string _hue;
        private int _isFancy;
        private string _milky;
        private string _measurement;
        private string _place;
        private string _blackDefect;
        private string _otherDefect;
        private string _eyeClean;

        private decimal? _freight;//运费 11-11 ?可空 无默认值的

        private DateTime _purchaseTime;//买入时间 


        private string _mediaID ;
        private string _hasImage;
        private string _hasVideo;
        private string _hasAtlas;


        private string _activeIP; //下单IP
        private string _activeAddress;//下单地址
        //
        #endregion

        #region Public Properties


        /// <summary>
        /// 源货号
        /// </summary>
        public string OriginSN
        {
            get { return _originSN; }
            set
            {
                this.ChangeNotify<string>("OriginSN", value, ref _originSN);
            }
        }

        /// <summary>
        /// 出货单号
        /// </summary>
        public string ShipNo
        {
            get { return _shipNo; }
            set
            {
                this.ChangeNotify<string>("ShipNo", value, ref _shipNo);
            }
        }

        /// <summary>
        /// 运费￥ 11-11
        /// </summary>
        public decimal? Freight
        {
            //? 可空 无默认值的 11-11
            get { return _freight; }
            set
            {
                this.ChangeNotify<decimal?>("Freight", value, ref _freight);
            }
        }

        /// <summary>
        /// 货品状态
        /// </summary>
        public int? Status
        {
            get { return _status; }
            set
            {
                this.ChangeNotify<int?>("Status", value, ref _status);
            }
        }

        //开始下单时间
        //public DateTime SCreateTime { get; set; }

        //结束下单时间
        //public DateTime ECreateTime { get; set; }
        //public string NickName { get; set; }
        /// <summary>
        /// BlackDefect
        /// </summary>
        public string BlackDefect
        {
            get { return _blackDefect; }
            set
            {
                this.ChangeNotify<string>("BlackDefect", value, ref _blackDefect);
            }
        }

        /// <summary>
        /// 形状：1.圆形，2.梨形，3.心形...
        /// </summary>
        public int Shape
        {
            get
            {
                return _shape;
            }
            set
            {
                this.ChangeNotify<int>("Shape", value, ref _shape);
            }
        }

        public string Color
        {
            get { return _color; }
            set { this.ChangeNotify<string>("Color", value, ref _color); }
        }

        public string Clarity
        {
            get { return _clarity; }
            set
            {
                this.ChangeNotify<string>("Clarity", value, ref _clarity);
            }
        }

        public string Cut
        {
            get { return _cut; }
            set { this.ChangeNotify<string>("Cut", value, ref _cut); }
        }

        /// <summary>
        /// 抛光
        /// </summary>
        public string Polish
        {
            get { return _polish; }
            set
            {
                this.ChangeNotify<string>("Polish", value, ref _polish);
            }
        }

        /// <summary>
        /// 对称
        /// </summary>
        public string Symmetry
        {
            get { return _symmetry; }
            set
            {
                this.ChangeNotify<string>("Symmetry", value, ref _symmetry);
            }
        }

        public decimal? Rapnet
        {
            get
            {
                return _rapnet;
            }
            set
            {
                this.ChangeNotify<decimal?>("Rapnet", value, ref _rapnet); //当临时字段有值时，rapnet加入修改列****************************很重要，搞死人
            }
        }

        /// <summary>
        /// 对称
        /// </summary>
        public string Fluorescence
        {
            get { return _fluorescence; }
            set
            {
                this.ChangeNotify<string>("Fluorescence", value, ref _fluorescence);
            }
        }

        /// <summary>
        /// 证书类型
        /// </summary>
        public string CertType
        {
            get { return _certType; }
            set
            {
                this.ChangeNotify<string>("CertType", value, ref _certType);
            }
        }

        /// <summary>
        /// 供货地点
        /// </summary>
        public string Place
        {
            get
            {
                return _place;
            }
            set
            {
                this.ChangeNotify<string>("Place", value, ref _place);
            }
        }

        /// <summary>
        /// Measurement
        /// </summary>
        public string Measurement
        {
            get { return _measurement; }
            set
            {
                this.ChangeNotify<string>("Measurement", value, ref _measurement);
            }
        }

        /// <summary>
        /// HA
        /// </summary>
        public string HA
        {
            get { return _hA; }
            set
            {
                this.ChangeNotify<string>("HA", value, ref _hA);
            }
        }

        /// <summary>
        /// Hue
        /// </summary>
        public string Hue
        {
            get { return _hue; }
            set
            {
                this.ChangeNotify<string>("Hue", value, ref _hue);
            }
        }


        /// <summary>
        /// OtherDefect
        /// </summary>
        public string OtherDefect
        {
            get { return _otherDefect; }
            set
            {
                this.ChangeNotify<string>("OtherDefect", value, ref _otherDefect);
            }
        }

        /// <summary>
        /// EyeClean
        /// </summary>
        public string EyeClean
        {
            get { return _eyeClean; }
            set
            {
                this.ChangeNotify<string>("EyeClean", value, ref _eyeClean);
            }
        }

        /// <summary>
        /// 奶色
        /// </summary>
        public string Milky
        {
            get { return _milky; }
            set
            {
                this.ChangeNotify<string>("Milky", value, ref _milky);
            }
        }

        /// <summary>
        /// 彩钻 0.否,1.是
        /// /// 
        /// </summary>
        public int IsFancy
        {
            get { return _isFancy; }
            set
            {
                this.ChangeNotify<int>("IsFancy", value, ref _isFancy);
            }
        }
        //




        /// <summary>
        /// OrderID.
        /// </summary>
        [Column(IsAutoIncrement = true)]
        public long? OrderID
        {
            get
            {
                return _orderID;
            }
            set
            {
                this.ChangeNotify<long?>("OrderID", value, ref _orderID);
            }
        }



        /// <summary>
        /// 订单状态：0.已逻辑删除,1.待审核,2.采购中,3.未付款,4.待发货,5.已发货,6.已完成
        /// </summary>
        public int? OrderStatus
        {
            get
            {
                return _orderStatus;
            }
            set
            {
                this.ChangeNotify<int?>("OrderStatus", value, ref _orderStatus);
            }
        }
        /// <summary>
        /// 订单类别
        /// </summary>
        public int? OrderType
        {
            get
            {
                return _orderType;
            }
            set
            {
                this.ChangeNotify<int?>("OrderType", value, ref _orderType);
            }
        }

        /// <summary>
        /// InventoryID.
        /// </summary>
        public long? InventoryID
        {
            get
            {
                return _inventoryID;
            }
            set
            {
                this.ChangeNotify<long?>("InventoryID", value, ref _inventoryID);
            }
        }
        
        /// <summary>
        /// 是否换货
        /// </summary>
        //public int Replacement
        //{
        //    get
        //    {
        //        return _replacement;
        //    }
        //    set
        //    {
        //        this.ChangeNotify<int>("Replacement", value, ref _replacement);
        //    }
        //}

        /// <summary>
        /// 回库状态 Online
        /// </summary>
        public int? Online
        {
            get
            {
                return _online;
            }
            set
            {
                this.ChangeNotify<int?>("Online", value, ref _online);
            }
        }

        /// <summary>
        /// PriceUSD.
        /// </summary>
        public decimal? PriceUSD
        {
            get
            {
                if (_priceUSD == null)
                    return 0;
                return _priceUSD;
            }
            set
            {
                this.ChangeNotify<decimal?>("PriceUSD", value, ref _priceUSD);
            }
        }


        /// <summary>
        /// PurchaseRMB
        /// </summary>
        public decimal? PurchaseRMB
        {
            get
            {
                if (_purchaseRMB == null)
                    return 0;
                return _purchaseRMB;
            }
            set
            {
                this.ChangeNotify<decimal?>("PurchaseRMB", value, ref _purchaseRMB);
            }
        }

        /// <summary>
        /// ReceiptPrice
        /// </summary>
        public decimal? ReceiptPrice
        {
            get
            {
                if (_receiptPrice == null)
                    return 0;
                return _receiptPrice;
            }
            set
            {
                this.ChangeNotify<decimal?>("ReceiptPrice", value, ref _receiptPrice);
            }
        }

        /// <summary>
        /// 付款状态：0.未付款,1.未付清,2.已结清
        /// </summary>
        public int? PaymentStatus
        {
            get { return _paymentStatus; }
            set { this.ChangeNotify<int?>("PaymentStatus", value, ref _paymentStatus); }
        }
        /// <summary>
        /// 收款 已付未付付
        /// </summary>
        public int? ReceiptStatus
        {
            get { return _receiptStatus; }
            set { this.ChangeNotify<int?>("ReceiptStatus", value, ref _receiptStatus); }
        }     
               

        /// <summary>
        /// CustomerID.
        /// </summary>
        public long? CustomerID
        {
            get
            {
                return _customerID;
            }
            set
            {
                this.ChangeNotify<long?>("CustomerID", value, ref _customerID);
            }
        }


        /// <summary>
        /// SupplierCode.
        /// </summary>
        public string SupplierCode
        {
            get
            {
                return _supplierCode;
            }
            set
            {
                this.ChangeNotify<string>("SupplierCode", Convert.ToString(value), ref _supplierCode);//数据中心为Int，需要转成string
            }
        }

        public int SalesUserID
        {
            get { return _salesUserID; }
            set { this.ChangeNotify<int>("SalesUserID", value, ref _salesUserID); }
        }

        public int PurchaseUserID
        {
            get { return _purchaseUserID; }
            set { this.ChangeNotify<int>("PurchaseUserID", value, ref _purchaseUserID); }
        }

        /// <summary>
        /// 生成时间
        /// </summary>
        public DateTime? CreateTime
        {
            get
            {
                return _createTime;
            }
            set
            {
                this.ChangeNotify<DateTime?>("CreateTime", value, ref _createTime);
            }
        }

        public string Remarks
        {
            get { return _Remarks; }
            set
            {
                this.ChangeNotify<string>("Remarks", value, ref _Remarks);
            }
        }

        /// <summary>
        /// SalesExchangerate.
        /// </summary>
        public decimal? SalesExchangerate
        {
            get
            {
                return _salesExchangerate;
            }
            set
            {
                this.ChangeNotify<decimal?>("SalesExchangerate", value, ref _salesExchangerate);
            }
        }

        /// <summary>
        /// PurchaseExchangerate.
        /// </summary>
        public decimal? PurchaseExchangerate
        {
            get
            {
                return _purchaseExchangerate;
            }
            set
            {
                this.ChangeNotify<decimal?>("PurchaseExchangerate", value, ref _purchaseExchangerate);
            }
        }

        /// <summary>
        /// 发货日期
        /// </summary>
        public DateTime? DeliveryTime
        {
            get { return _deliveryTime; }
            set
            {
                this.ChangeNotify<DateTime?>("DeliveryTime", value, ref _deliveryTime);
            }
        }

        /// <summary>
        /// 出货日期
        /// </summary>
        public DateTime? ShipTime
        {
            get { return _shipTime; }
            set
            {
                this.ChangeNotify<DateTime?>("ShipTime", value, ref _shipTime);
            }
        }  

        /// <summary>
        /// 是否到货
        /// </summary>
        public int? Arrival
        {
            get { return _arrival; }
            set
            {
                this.ChangeNotify<int?>("Arrival", value, ref _arrival);
            }
        }

        /// <summary>
        /// CurType 到货结算币种
        /// </summary>
        public short? CurType
        {
            get { return _curType; }
            set
            {
                this.ChangeNotify<short?>("CurType", value, ref _curType);
            }
        }


        /// <summary>
        /// 入库时间
        /// </summary>
        public string ArrivalTime
        {
            get { return _arrivalTime; }
            set
            {
                this.ChangeNotify<string>("ArrivalTime", value, ref _arrivalTime);
            }
        }

        /// <summary>
        /// 支付时间
        /// </summary>
        public DateTime? PayTime
        {
            get { return _payTime; }
            set
            {
                this.ChangeNotify<DateTime?>("PayTime", value, ref _payTime);
            }
        }

        public DateTime? RecTime
        {
            get { return _recTime; }
            set
            {
                this.ChangeNotify<DateTime?>("RecTime", value, ref _recTime);
            }
        } 

        /// <summary>
        /// 确认退点
        /// </summary>
        public decimal? Confirmdiscount
        {
            get { return _confirmdiscount; }
            set { this.ChangeNotify<decimal?>("Confirmdiscount", value, ref _confirmdiscount); }
        }

        public decimal? DiscountReturn
        {
            get { return _discountReturn; }
            set {
                this.ChangeNotify<decimal?>("DiscountReturn", value, ref _discountReturn); 
            }
        }

        /// <summary>
        ///  货号
        /// </summary>
        public string SN
        {
            get { return _sN; }
            set
            {
                this.ChangeNotify<string>("SN", value, ref _sN);
            }
        }
        /// <summary>
        /// 钻石重量
        /// </summary>
        public decimal? Weight {
            get { return _weight; }
            set { this.ChangeNotify<decimal?>("Weight", value, ref _weight); }
        }
        /// <summary>
        /// 证书号
        /// </summary>
        public string CertNo {
            get { return _certno; }
            set { this.ChangeNotify<string>("CertNo", value, ref _certno); }
        }

   

        /// <summary>
        /// 采购确认销售价格
        /// </summary>
        public decimal? ConfirmPrice
        { 
            get {
                if (_confirmprice == null)
                    return 0;
                return _confirmprice; }
            set { this.ChangeNotify<decimal?>("ConfirmPrice",value, ref _confirmprice); }
        }

        /// <summary>
        /// 卖出美金 2017-01-11
        /// </summary>
        public decimal? ConfirmUSD
        {
            get
            {
                if (_confirmusd == null)
                    return 0;
                return _confirmusd; }
            set { this.ChangeNotify<decimal?>("ConfirmUSD", value, ref _confirmusd); }
        }

        public string PurchaseRemarks
        {
            get { return _purchaseremarks; }
            set { this.ChangeNotify<string>("PurchaseRemarks", value, ref _purchaseremarks); }
        }

        /// <summary>
        /// 取货员备注 (采购填写货品备注,例如 肉眼干净 奶咖绿等）
        /// </summary>
        public string GoodsRemark
        {
            get { return _goodsremark; }
            set { this.ChangeNotify<string>("GoodsRemark", value, ref _goodsremark); }
        }

        /// <summary>
        /// 销售员备注
        /// </summary>
        public string SalesRemarks
        {
            get { return _salesremark; }
            set { this.ChangeNotify<string>("SalesRemarks", value, ref _salesremark); }
        }

        /// <summary>
        /// 出货备注
        /// </summary>
        public string ShipRemarks
        {
            get { return _shipremark; }
            set { this.ChangeNotify<string>("ShipRemarks", value, ref _shipremark); }
        }
        public DateTime PurchaseTime
        {
            get { return _purchaseTime; }
            set
            {
                this.ChangeNotify<DateTime>("PurchaseTime", value, ref _purchaseTime);

            }
        }
        public int[] OrderIds { get; set; }

        private string purchaseSupplier;//原供应商

        public string PurchaseSupplier
        {
            get { return purchaseSupplier; }
            set
            {
                this.ChangeNotify<string>("PurchaseSupplier", value, ref purchaseSupplier);

            }
        }

        #endregion

        #region Private Properties

        private decimal? _buyDis; //供应商dis
        private decimal? _buyRMBPrice;//供应商rmb
        private decimal? _buyUSDPrice;//供应商usd


        //
        #endregion

        #region Public Properties

        /// <summary>
        ///供应商 折扣
        /// </summary>
        public decimal? BuyDis
        {
            get { return _buyDis; }
            set { this.ChangeNotify<decimal?>("BuyDis", value, ref _buyDis); }
        }

        /// <summary>
        /// 供应商美金 2017-01-11
        /// </summary>
        public decimal? BuyUSDPrice
        {
            get { return _buyUSDPrice; }
            set { this.ChangeNotify<decimal?>("BuyUSDPrice", value, ref _buyUSDPrice); }
        }
        /// <summary>
        /// 供应商RMB 2017-01-11
        /// </summary>
        public decimal? BuyRMBPrice
        {
            get { return _buyRMBPrice; }
            set { this.ChangeNotify<decimal?>("BuyRMBPrice", value, ref _buyRMBPrice); }
        }
         
        #endregion

        #region 图片 影像
        public string MediaID
        {
            get { return _mediaID; }
            set { this.ChangeNotify<string>("MediaID", value, ref _mediaID); }
        }
        public string HasImage
        {
            get { return _hasImage; }
            set { this.ChangeNotify<string>("HasImage", value, ref _hasImage); }
        }
        public string HasVideo
        {
            get { return _hasVideo; }
            set { this.ChangeNotify<string>("HasVideo", value, ref _hasVideo); }
        }
        public string HasAtlas
        {
            get { return _hasAtlas; }
            set { this.ChangeNotify<string>("HasAtlas", value, ref _hasAtlas); }
        }
        #endregion

        #region IP  地址
        public string ActiveIP
        {
            get { return _activeIP; }
            set { this.ChangeNotify<string>("ActiveIP", value, ref _activeIP); }
        }
        public string ActiveAddress
        {
            get { return _activeAddress; }
            set { this.ChangeNotify<string>("ActiveAddress", value, ref _activeAddress); }
        }
        #endregion

        #region 现货的采购汇率
        private decimal? _buyExchangerate;
        public decimal? BuyExchangerate
        {
            get { return _buyExchangerate; }
            set { this.ChangeNotify<decimal?>("BuyExchangerate", value, ref _buyExchangerate); }
        }
        #endregion

        #region 订单标记
        private int? _orderMark;
        public int? orderMark
        {
            get { return _orderMark; }
            set { this.ChangeNotify<int?>("orderMark", value, ref _orderMark); }
        }
        #endregion
    }
}
